package esmp.jtt808.model.platform;

import common.utils.DataPackUtil;
import esmp.jtt808.model.Encoder;

/**
 * Created by dave on 18-7-20 下午3:03.
 * 平台通用应答消息体，0x8001
 */
public class PlatCommonResp implements Encoder {
    private int terminalSequenceNo;  // 终端消息流水号
    private int terminalMsgId;       // 终端消息ID
    private int result;              // 0：成功／确认，1：失败，2：消息有误，3：不支持，4：报警处理确认

    @Override
    public byte[] encode() {
        byte[] ret = new byte[5];
        DataPackUtil.writeWord(ret, 0, terminalSequenceNo);
        DataPackUtil.writeWord(ret, 2, terminalMsgId);
        DataPackUtil.writeByte(ret, 4, result);
        return ret;
    }

    public int getTerminalSequenceNo() {
        return terminalSequenceNo;
    }

    public void setTerminalSequenceNo(int terminalSequenceNo) {
        this.terminalSequenceNo = terminalSequenceNo;
    }

    public int getTerminalMsgId() {
        return terminalMsgId;
    }

    public void setTerminalMsgId(int terminalMsgId) {
        this.terminalMsgId = terminalMsgId;
    }

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }
}
